package com.Utils;

import java.util.Random;

public class UserName {
    //生成随机用户名，数字和字母组成,
        private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

        public static String generateRandomString(int length) {
            StringBuilder sb = new StringBuilder();
            Random random = new Random();

            for (int i = 0; i < length; i++) {
                int index = random.nextInt(CHARACTERS.length());
                char c = CHARACTERS.charAt(index);
                sb.append(c);
            }

            return sb.toString();
        }
}

